package com.amat0urheu.dao;


import com.amat0urheu.pojo.CloudPojo.ImagePojo;
import com.amat0urheu.pojo.CloudPojo.NetWork;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ImageMapper {
    @Select("select * from mc_image where openstackIP=#{ip}")
    List<ImagePojo> getAllImages(String ip);
    @Insert("INSERT INTO mc_image (Id,imageId,imageName, instanceType,flagNumber,openstackIP) VALUES (#{image.Id},#{image.imageId},#{image.imageName},#{image.instanceType} ,#{image.flagNumber},#{image.openstackIP})")
    int inserImage(@Param("image") ImagePojo imagePojo);
    @Delete("delete  from mc_image where  openstackIP=#{openstackIP}")
    int dropImages(String openstackIP);
    @Select("select id, imageName from mc_image ")
    List<ImagePojo> getAllMachine(String ip);
    @Select("select instanceType from mc_image where id=#{victimId}")
    String getFlavorofVM(Integer victimId);
    @Select("select flagNumber from mc_image where imageName=#{name}")
    Integer getFlagNum(String name);
    @Select("select imageName from mc_image where id=#{victimId}")
    String getImageName(Integer victimId);
    @Update("update mc_image set instanceType=#{image.instanceType},flagNumber=#{image.flagNumber} where Id=#{image.Id}")
    int updateImage(@Param("image")ImagePojo image);
    @Select("select max(Id) from mc_image ")
    Integer getMaxId();

    int deleteNotIds(@Param("ids") List<Integer> ids);
}
